package com.uraurora.crescent.function;

import java.util.Objects;

public interface Action6<T1, T2, T3, T4, T5, T6> {
    void on(T1 t1, T2 t2, T3 t3, T4 t4, T5 t5, T6 t6);

    default Action6<T1, T2, T3, T4, T5, T6> before(Action6<? super T1, ? super T2, ? super T3, ? super T4, ? super T5, ? super T6> before) {
        Objects.requireNonNull(before);
        return (T1 t1,T2 t2, T3 t3, T4 t4, T5 t5, T6 t6) -> { before.on(t1, t2, t3, t4, t5, t6); on(t1, t2, t3, t4, t5, t6); };
    }

    default Action6<T1, T2, T3, T4, T5, T6> after(Action6<? super T1, ? super T2, ? super T3, ? super T4, ? super T5, ? super T6> after) {
        Objects.requireNonNull(after);
        return (T1 t1,T2 t2, T3 t3, T4 t4, T5 t5, T6 t6) -> { on(t1, t2, t3, t4, t5, t6); after.on(t1, t2, t3, t4, t5, t6); };
    }

    //<editor-fold desc="柯里化与反柯里化">
    default Action5<T2, T3, T4, T5, T6> curry1(T1 t1){
        return (t2, t3, t4, t5, t6) -> on(t1, t2, t3, t4, t5, t6);
    }

    default Action5<T1, T3, T4, T5, T6> curry2(T2 t2){
        return (t1, t3, t4, t5, t6) -> on(t1, t2, t3, t4, t5, t6);
    }

    default Action5<T1, T2, T4, T5, T6> curry3(T3 t3){
        return (t1, t2, t4, t5, t6) -> on(t1, t2, t3, t4, t5, t6);
    }

    default Action5<T1, T2, T3, T5, T6> curry4(T4 t4){
        return (t1, t2, t3, t5, t6) -> on(t1, t2, t3, t4, t5, t6);
    }

    default Action5<T1, T2, T3, T4, T6> curry5(T5 t5){
        return (t1, t2, t3, t4, t6) -> on(t1, t2, t3, t4, t5, t6);
    }

    default Action5<T1, T2, T3, T4, T5> curry6(T6 t6){
        return (t1, t2, t3, t4, t5) -> on(t1, t2, t3, t4, t5, t6);
    }

    default Action4<T3, T4, T5, T6> curry(T1 t1, T2 t2){
        return (t3, t4, t5, t6) -> on(t1, t2, t3, t4, t5, t6);
    }

    default Action3<T4, T5, T6> curry(T1 t1, T2 t2, T3 t3){
        return (t4, t5, t6)->on(t1, t2, t3, t4, t5, t6);
    }

    default Action2<T5, T6> curry(T1 t1, T2 t2, T3 t3, T4 t4){
        return (t5, t6) -> on(t1, t2, t3, t4, t5, t6);
    }

    default Action1<T6> curry(T1 t1, T2 t2, T3 t3, T4 t4, T5 t5){
        return t6 -> on(t1, t2, t3, t4, t5, t6);
    }
    //</editor-fold>

}
